home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
10,000 Great Games
/
10,000 Great Games.iso
/
Product
/
66
/
data1.cab
/
Source_Files
/
Src
/
Gamma.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2000-01-16
|
1KB
|
72 lines
#include "stdafx.h"
#include "Gamma.h"
CGamma::CGamma(CWnd* pParent)
: CDialog(CGamma::IDD, pParent)
{
//{{AFX_DATA_INIT(CGamma)
//}}AFX_DATA_INIT
}
void CGamma::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGamma)
DDX_Control(pDX, IDC_GAMMA_VALUE, m_Gamma);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CGamma, CDialog)
//{{AFX_MSG_MAP(CGamma)
ON_BN_CLICKED(IDAPPLY, OnApply)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CGamma::OnInitDialog()
{
CDialog::OnInitDialog();
m_Gamma.SetRange(0, 100);
m_Gamma.SetTicFreq(10);
m_Gamma.SetPos((int)((1.5 - gamma) * 100));
return TRUE;
}
void CGamma::OnOK()
{
OnApply();
CDialog::OnOK();
}
void CGamma::OnApply()
{
// Set gamma correction
double g = 1.5 - (double)m_Gamma.GetPos() / 100;
if (g == gamma)
return;
gamma = g;
// Reload game
CWaitCursor wait;
save_level(autosave_level);
deinit_game_loop();
deinit_game_data();
deinit_directdraw();
init_directdraw_inawin();
init_game_data();
init_game_loop();
load_level(autosave_level);
gamewindow->Invalidate();
}